package org.biubiu0002.baiblog.im.utils;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * @Author: biubiu0002
 * @Date: 2022/8/31 12:44
 **/
@Component
public class SpringUtils implements ApplicationContextAware {

    private static ApplicationContext context;

    public static Object getBean(String name){
        return context.getBean(name);
    }

    @Override
    public synchronized void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        context = applicationContext;
    }
}
